
             
/**
 * 
 *
 * @File name:  QueryTSuppliersAction.java 
 * @Create on:  2011-10-31 23:59:947
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        
package com.boho.estates.suppliers.action;

            
import java.sql.Connection;
import java.util.List;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.service.MessageService;

import com.boho.estates.suppliers.common.Constant;
import com.boho.estates.suppliers.dao.TSuppliersDao;

public class QueryTSuppliersAction extends ActionImp {
	private String exception = "";
	private String suppliersType = "";
	private String suppliersName = "";
	private Connection con=null;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		if(Constant.SUPPLIERS_TYPE_X.equalsIgnoreCase(suppliersType)){
			exception = Constant.X_EXCEPTION;
		}
		else if(Constant.SUPPLIERS_TYPE_Z.equalsIgnoreCase(suppliersType)){
			exception = Constant.Z_EXCEPTION;
		}
		atx.setErrorContext("BOHO_COMMON_1004", MessageService.getMessage("BOHO_COMMON_1004"),exception,ex);
	}
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		String departIds  = (String)atx.getSessionValue(com.boho.common.Constant.SESSION_DEPART_ARRAY);
		List list=TSuppliersDao.queryTSuppliers(con, suppliersType,suppliersName, departIds);
		atx.setValue("T_SUPPLIERS", list.toArray());
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		con = atx.getConection();
		suppliersType = atx.getStringValue("SUPPLIERS_TYPE", "");
		suppliersName = atx.getStringValue("SUPPLIERS_NAME", "");
		return 1;
	}
}
